package com.test;


import java.io.File;
import java.util.List;
import java.util.Random;

/**
 *
 *
 * @Author liw
 * @Date 2021/5/18 9:01
 * @Version 1.0
 */
public class RunTest {

    // http://www.voidcn.com/article/p-kzltoadj-bos.html
    public static void main(String[] args) {
        run();
    }

    private static void run () {
        Random rand = new Random();
        for (int i = 0; i < 1000; i++) {
            int value = rand.nextInt(100000);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(getSum(value));
        }
    }

    private static int getSum (int n) {
        if (n < 2) {
            return n;
        }
        return n + getSum(n - 1);
    }

}
